package com.yunlongn.httpclient.factory;

import java.lang.reflect.Proxy;

public class HttpServerFactory {


    public static Object createProxy(Class<?> apiClass, ClassLoader classLoader, String host) {
        if (!apiClass.isInterface()) {
            throw new UnsupportedOperationException(apiClass + "必须为接口！否则无法实现请求功能");
        }
        return Proxy.newProxyInstance(classLoader, new Class<?>[]{apiClass}, new HttpServerHandler(apiClass,host));
    }


}
